package com.yitianyigexiangfa.dubbo.test;

import com.yitianyigexiangfa.dubbo.IBookService;
import com.yitianyigexiangfa.dubbo.entity.Book;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author Bill Lau
 * @date 2018-03-27
 */
public class BookServiceConsumer {

    public static void main(String[] args) throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"dubbo-base-consumer.xml"});
        context.start();
        IBookService bookService = (IBookService)context.getBean("bookService"); // 获取远程服务代理
        String books = bookService.getBooks();
        System.out.println( books ); // 显示调用结果
        Book book = bookService.getBookById(1);
        System.out.println(book.toString()); // 显示调用结果
    }

}
